public class Duration {
    private int hours;
    private int minutes;
    private int seconds;

    // 三参构造器
    public Duration(int hours, int minutes, int seconds) {
        this.hours = hours;
        this.minutes = minutes;
        this.seconds = seconds;
    }

    // 一参构造器，将总秒数转换为时分秒
    public Duration(int totalSeconds) {
        this.hours = totalSeconds / 3600;
        int remaining = totalSeconds % 3600;
        this.minutes = remaining / 60;
        this.seconds = remaining % 60;
    }

    public int getHours() {
        return hours;
    }

    public int getMinutes() {
        return minutes;
    }

    public int getSeconds() {
        return seconds;
    }

    public int getTotalSeconds() {
        return hours * 3600 + minutes * 60 + seconds;
    }

    @Override
    public String toString() {
        return getHours()+":"+getMinutes()+":"+getSeconds();
    }
}